Release 10.1A: OpenEdge Development:
ADM and SmartObjects


SmartLink events

For each SmartLink type, the source and target objects have specific responsibilities to each other. These responsibilities are fulfilled by the methods contained in the SmartObject; therefore, the type of links a particular SmartObject can support is determined by the methods it contains.

The specific responsibilities of a pair of linked SmartObjects to each other depend only on the type of SmartLink that connects them, not on their object types. For example, in a TableIO relationship, the target object always has the same responsibilities, regardless of whether it is a SmartDataBrowser or a SmartDataViewer. Specifically:

The source and target objects, therefore, must SUBSCRIBE to the correct set of events, or they cannot interact as expected. These events evaluate to the internal procedures in the source and target objects.

Subscription occurs when you add the SmartLink: the addLink procedure (in smart.p) SUBSCRIBEs the target procedure to the SourceEvents for the link and SUBSCRIBEs the source procedure to the TargetEvents, as shown in the following code fragment:

/* SUBSCRIBE to all the appropriate events on each side of the link. 
     First SUBSCRIBE the target to all the events it says it wants
     from its source. */
  cEvents = dynamic-function("get":U + pcLink + "SourceEvents":U IN phTarget) 
      NO-ERROR.
  IF cEvents NE ? THEN
  DO iEvent = 1 TO NUM-ENTRIES(cEvents):
    SUBSCRIBE PROCEDURE phTarget TO ENTRY(iEvent, cEvents) IN phSource.
  END.
  /* Then SUBSCRIBE the source to all the events (if any) that it wants
     from its target. */
  cEvents = dynamic-function("get":U + pcLink + "TargetEvents":U IN phSource) 
      NO-ERROR.
  IF cEvents NE ? THEN
  DO iEvent = 1 TO NUM-ENTRIES(cEvents):
    SUBSCRIBE PROCEDURE phSource TO ENTRY(iEvent, cEvents) IN phTarget.
  END.

  RETURN.
END PROCEDURE. 

This behavior happens automatically, in the addLink procedure.

For more information on PUBLISH and SUBSCRIBE, see OpenEdge Development: Progress 4GL Handbook or OpenEdge Development: Progress 4GL Reference . For a description of dynamic-function, see OpenEdge Development: Progress 4GL Reference .

The following sections describe the responsibilities of the source and target SmartObjects for each ADM-recognized SmartLink type. For each SmartLink type, these sections also list the subscribed events/internal procedures required by the source and target objects.


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095